const api = require('../../utils/api.js');
const app = getApp();

Page({
  data: {
    list: [],
    unit: '',
  },

  onLoad(options) {
    let that = this;
    app.loadCurrencyUnit().then(res => {
      that.setData({
        unit: res.unit,
      });
    });
    this.setData({
      status: options.status || 0,
    });
    this.loadData(options);
  },

  loadData() {
    let that = this;
    wx.showLoading({
      title: '加载中',
    });
    app.ws_micro_shoprequest({
      url: api.wheel.index,
      data: {
        status: that.data.status,
      },
      success: function(res) {
        if (res.code === 0) {
          that.setData({
            list: res.data.list,
          });
        }
      },
      complete: function() {
        wx.hideLoading();
      },
    });
  },
});
